package com.weim.study.shiro.controller;

import com.weim.study.shiro.entity.User;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/api/shiro")
public class UserController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @GetMapping("/user")
    public String goUser () {

        logger.info("go user");

        return "user";
    }

    @GetMapping("/user/add")
    @RequiresPermissions("add")
    public String addUser() {
        logger.info("add user");
        return "user";
    }

    @GetMapping("/user/update")
    @RequiresPermissions("update")
    public String updateUser() {
        logger.info("update user");
        return "user";
    }

    @GetMapping("/user/delete")
    @RequiresPermissions("delete")
    public String deleteUser() {
        logger.info("delete user");
        return "user";
    }

}
